

#import "AppDelegate.h"
#import "Masonry.h"
#import "NetWorkModal.h"
#import <AFNetworking.h>
#import "RestaurantCore.h"
#import <MBProgressHUD.h>
#import "iToast.h"
#import "UIImageView+AFNetworking.h"
#import "PullingRefreshTableView.h"
#if DEBUG
#define debuglog(format, ...)   NSLog(format, __VA_ARGS__)
#else
#define debuglog(format, ...)
#endif

#define appDelegate  (AppDelegate *)[[UIApplication sharedApplication] delegate]

#define kMainScreenHeight ([UIScreen mainScreen].applicationFrame.size.height)
#define isIphone4 kMainScreenHeight==460.0
#define isIphone5 kMainScreenHeight==548.0
#define isIphone6 kMainScreenHeight==647.0
#define isIphone6Plus kMainScreenHeight==716.0
#define viewHeight (kMainScreenHeight<716.0?360:420)

#define leftPadding 17

#define animationTime 0.3


#define viewPadding  (kMainScreenHeight<548?35:kMainScreenHeight<647.0?45:kMainScreenHeight<716.0?55:55)
#define topwidth  10
#define firstWidth 50

#define FS(string) (string == nil || (NSNull *)string == [NSNull null])?@"":string

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size):NO)

// 判断当前系统版本号
#define PPSystemVersionGreaterOrEqualThan(version) ([[[UIDevice currentDevice] systemVersion] floatValue] >= version)

#define kAppScreenWidth   [[UIScreen mainScreen] bounds].size.width
#define kAppScreenHeight   [[UIScreen mainScreen] bounds].size.height
#define kNavigationBarHeight   (PPSystemVersionGreaterOrEqualThan(7.0)?64:44)


#define kDocumentsPath [NSString stringWithFormat:@"%@/Documents",NSHomeDirectory()]

//是否隐藏导航nav
#define NAVHIDDEN(HIDDEN) self.navigationController.navigationBarHidden = HIDDEN;

//添加左边导航栏按钮
#define ADDLEFTBTN(CTLR,IMG,TITLE,SEL)\
{\
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];\
leftButton.frame = CGRectMake(0, 0, 25, 20);\
[leftButton setTitle:TITLE forState:UIControlStateNormal];\
[[leftButton  titleLabel] setFont:[UIFont systemFontOfSize:15]];\
[leftButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 10, 0, 0)];\
[leftButton setBackgroundImage:[UIImage imageNamed:IMG] forState:UIControlStateNormal];\
[leftButton addTarget:self action:SEL forControlEvents:UIControlEventTouchUpInside];\
\
UIBarButtonItem *leftButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];\
self.navigationItem.leftBarButtonItem = leftButtonItem;\
}
//添加右边导航栏按钮
#define ADDRIGHTBTN(CTLR,IMG,TITLE,SEL,Height)\
{\
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];\
leftButton.frame = CGRectMake(0, 0, 25, Height);\
[leftButton setTitle:TITLE forState:UIControlStateNormal];\
[[leftButton  titleLabel] setFont:[UIFont systemFontOfSize:15]];\
[leftButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 10, 0, 0)];\
[leftButton setBackgroundImage:[UIImage imageNamed:IMG] forState:UIControlStateNormal];\
[leftButton addTarget:self action:SEL forControlEvents:UIControlEventTouchUpInside];\
\
UIBarButtonItem *leftButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];\
self.navigationItem.rightBarButtonItem = leftButtonItem;\
}
//alert
#define  ALERT(CONTACT)\
{\
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"" \
message:CONTACT \
delegate:self \
cancelButtonTitle:@"好的" \
otherButtonTitles:nil]; \
[alertView show]; \
[alertView release]; \
}


